//
//  ZCInvolvedDetailsModelLatestSixSponsors.m
//
//  Created by   on 16/3/28
//  Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//

#import "ZCInvolvedDetailsModelLatestSixSponsors.h"


NSString *const kZCInvolvedDetailsModelLatestSixSponsorsStatus = @"status";
NSString *const kZCInvolvedDetailsModelLatestSixSponsorsPaytime = @"paytime";
NSString *const kZCInvolvedDetailsModelLatestSixSponsorsAvatar = @"avatar";
NSString *const kZCInvolvedDetailsModelLatestSixSponsorsId = @"id";
NSString *const kZCInvolvedDetailsModelLatestSixSponsorsMid = @"mid";
NSString *const kZCInvolvedDetailsModelLatestSixSponsorsUsername = @"username";
NSString *const kZCInvolvedDetailsModelLatestSixSponsorsPaytype = @"paytype";
NSString *const kZCInvolvedDetailsModelLatestSixSponsorsFid = @"fid";
NSString *const kZCInvolvedDetailsModelLatestSixSponsorsType = @"type";
NSString *const kZCInvolvedDetailsModelLatestSixSponsorsMoney = @"money";
NSString *const kZCInvolvedDetailsModelLatestSixSponsorsRpId = @"rp_id";


@interface ZCInvolvedDetailsModelLatestSixSponsors ()

- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict;

@end

@implementation ZCInvolvedDetailsModelLatestSixSponsors

@synthesize status = _status;
@synthesize paytime = _paytime;
@synthesize avatar = _avatar;
@synthesize latestSixSponsorsIdentifier = _latestSixSponsorsIdentifier;
@synthesize mid = _mid;
@synthesize username = _username;
@synthesize paytype = _paytype;
@synthesize fid = _fid;
@synthesize type = _type;
@synthesize money = _money;
@synthesize rpId = _rpId;


+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict
{
    return [[self alloc] initWithDictionary:dict];
}

- (instancetype)initWithDictionary:(NSDictionary *)dict
{
    self = [super init];
    
    // This check serves to make sure that a non-NSDictionary object
    // passed into the model class doesn't break the parsing.
    if(self && [dict isKindOfClass:[NSDictionary class]]) {
            self.status = [self objectOrNilForKey:kZCInvolvedDetailsModelLatestSixSponsorsStatus fromDictionary:dict];
            self.paytime = [self objectOrNilForKey:kZCInvolvedDetailsModelLatestSixSponsorsPaytime fromDictionary:dict];
            self.avatar = [self objectOrNilForKey:kZCInvolvedDetailsModelLatestSixSponsorsAvatar fromDictionary:dict];
            self.latestSixSponsorsIdentifier = [self objectOrNilForKey:kZCInvolvedDetailsModelLatestSixSponsorsId fromDictionary:dict];
            self.mid = [self objectOrNilForKey:kZCInvolvedDetailsModelLatestSixSponsorsMid fromDictionary:dict];
            self.username = [self objectOrNilForKey:kZCInvolvedDetailsModelLatestSixSponsorsUsername fromDictionary:dict];
            self.paytype = [self objectOrNilForKey:kZCInvolvedDetailsModelLatestSixSponsorsPaytype fromDictionary:dict];
            self.fid = [self objectOrNilForKey:kZCInvolvedDetailsModelLatestSixSponsorsFid fromDictionary:dict];
            self.type = [self objectOrNilForKey:kZCInvolvedDetailsModelLatestSixSponsorsType fromDictionary:dict];
            self.money = [self objectOrNilForKey:kZCInvolvedDetailsModelLatestSixSponsorsMoney fromDictionary:dict];
            self.rpId = [self objectOrNilForKey:kZCInvolvedDetailsModelLatestSixSponsorsRpId fromDictionary:dict];

    }
    
    return self;
    
}

- (NSDictionary *)dictionaryRepresentation
{
    NSMutableDictionary *mutableDict = [NSMutableDictionary dictionary];
    [mutableDict setValue:self.status forKey:kZCInvolvedDetailsModelLatestSixSponsorsStatus];
    [mutableDict setValue:self.paytime forKey:kZCInvolvedDetailsModelLatestSixSponsorsPaytime];
    [mutableDict setValue:self.avatar forKey:kZCInvolvedDetailsModelLatestSixSponsorsAvatar];
    [mutableDict setValue:self.latestSixSponsorsIdentifier forKey:kZCInvolvedDetailsModelLatestSixSponsorsId];
    [mutableDict setValue:self.mid forKey:kZCInvolvedDetailsModelLatestSixSponsorsMid];
    [mutableDict setValue:self.username forKey:kZCInvolvedDetailsModelLatestSixSponsorsUsername];
    [mutableDict setValue:self.paytype forKey:kZCInvolvedDetailsModelLatestSixSponsorsPaytype];
    [mutableDict setValue:self.fid forKey:kZCInvolvedDetailsModelLatestSixSponsorsFid];
    [mutableDict setValue:self.type forKey:kZCInvolvedDetailsModelLatestSixSponsorsType];
    [mutableDict setValue:self.money forKey:kZCInvolvedDetailsModelLatestSixSponsorsMoney];
    [mutableDict setValue:self.rpId forKey:kZCInvolvedDetailsModelLatestSixSponsorsRpId];

    return [NSDictionary dictionaryWithDictionary:mutableDict];
}

- (NSString *)description 
{
    return [NSString stringWithFormat:@"%@", [self dictionaryRepresentation]];
}

#pragma mark - Helper Method
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict
{
    id object = [dict objectForKey:aKey];
    return [object isEqual:[NSNull null]] ? nil : object;
}


#pragma mark - NSCoding Methods

- (id)initWithCoder:(NSCoder *)aDecoder
{
    self = [super init];

    self.status = [aDecoder decodeObjectForKey:kZCInvolvedDetailsModelLatestSixSponsorsStatus];
    self.paytime = [aDecoder decodeObjectForKey:kZCInvolvedDetailsModelLatestSixSponsorsPaytime];
    self.avatar = [aDecoder decodeObjectForKey:kZCInvolvedDetailsModelLatestSixSponsorsAvatar];
    self.latestSixSponsorsIdentifier = [aDecoder decodeObjectForKey:kZCInvolvedDetailsModelLatestSixSponsorsId];
    self.mid = [aDecoder decodeObjectForKey:kZCInvolvedDetailsModelLatestSixSponsorsMid];
    self.username = [aDecoder decodeObjectForKey:kZCInvolvedDetailsModelLatestSixSponsorsUsername];
    self.paytype = [aDecoder decodeObjectForKey:kZCInvolvedDetailsModelLatestSixSponsorsPaytype];
    self.fid = [aDecoder decodeObjectForKey:kZCInvolvedDetailsModelLatestSixSponsorsFid];
    self.type = [aDecoder decodeObjectForKey:kZCInvolvedDetailsModelLatestSixSponsorsType];
    self.money = [aDecoder decodeObjectForKey:kZCInvolvedDetailsModelLatestSixSponsorsMoney];
    self.rpId = [aDecoder decodeObjectForKey:kZCInvolvedDetailsModelLatestSixSponsorsRpId];
    return self;
}

- (void)encodeWithCoder:(NSCoder *)aCoder
{

    [aCoder encodeObject:_status forKey:kZCInvolvedDetailsModelLatestSixSponsorsStatus];
    [aCoder encodeObject:_paytime forKey:kZCInvolvedDetailsModelLatestSixSponsorsPaytime];
    [aCoder encodeObject:_avatar forKey:kZCInvolvedDetailsModelLatestSixSponsorsAvatar];
    [aCoder encodeObject:_latestSixSponsorsIdentifier forKey:kZCInvolvedDetailsModelLatestSixSponsorsId];
    [aCoder encodeObject:_mid forKey:kZCInvolvedDetailsModelLatestSixSponsorsMid];
    [aCoder encodeObject:_username forKey:kZCInvolvedDetailsModelLatestSixSponsorsUsername];
    [aCoder encodeObject:_paytype forKey:kZCInvolvedDetailsModelLatestSixSponsorsPaytype];
    [aCoder encodeObject:_fid forKey:kZCInvolvedDetailsModelLatestSixSponsorsFid];
    [aCoder encodeObject:_type forKey:kZCInvolvedDetailsModelLatestSixSponsorsType];
    [aCoder encodeObject:_money forKey:kZCInvolvedDetailsModelLatestSixSponsorsMoney];
    [aCoder encodeObject:_rpId forKey:kZCInvolvedDetailsModelLatestSixSponsorsRpId];
}

- (id)copyWithZone:(NSZone *)zone
{
    ZCInvolvedDetailsModelLatestSixSponsors *copy = [[ZCInvolvedDetailsModelLatestSixSponsors alloc] init];
    
    if (copy) {

        copy.status = [self.status copyWithZone:zone];
        copy.paytime = [self.paytime copyWithZone:zone];
        copy.avatar = [self.avatar copyWithZone:zone];
        copy.latestSixSponsorsIdentifier = [self.latestSixSponsorsIdentifier copyWithZone:zone];
        copy.mid = [self.mid copyWithZone:zone];
        copy.username = [self.username copyWithZone:zone];
        copy.paytype = [self.paytype copyWithZone:zone];
        copy.fid = [self.fid copyWithZone:zone];
        copy.type = [self.type copyWithZone:zone];
        copy.money = [self.money copyWithZone:zone];
        copy.rpId = [self.rpId copyWithZone:zone];
    }
    
    return copy;
}


@end
